<template>
  <div>
    <bread-crumb :one="'平台管理'" :two="'集群节点管理'"></bread-crumb>

    <el-form :inline="true" :model="formData">
      <el-form-item label="服务器名：">
        <el-input v-model="formData.serverName"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="search" @click="handleSearch()">搜索</el-button>
        <el-button type="primary" icon="delete" @click="handleClear()">清空</el-button>
        <el-button type="primary" icon="plus" @click="handleAdd()">新增</el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading.body="loading" :data="tableData" border>
      <el-table-column prop="server_name" label="服务器名"></el-table-column>
      <el-table-column prop="server_ip" label="服务器Ip"></el-table-column>
      <el-table-column prop="manager_url" label="管理界面Url" width="300"></el-table-column>
      <el-table-column prop="script_path" label="脚本路径"></el-table-column>
      <el-table-column prop="state" label="状态" align="center">
        <template slot-scope="scope">
          <span class="green_circle" v-if="scope.row.state"></span>
          <span class="red_circle" v-else></span>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="200" align="center">
        <template slot-scope="scope">
          <el-button type="text" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
          <el-button type="text" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <Pagination />
  </div>
</template>

<script>
  import BreadCrumb from "@/components/BreadCrumb.vue";
  import {mixins} from "@/core";

  export default {
    components: {
      BreadCrumb
    },
    mixins: [mixins],
    data () {
      return {
      	API: {
      		query: "/gafe/servers",
          deleteUrl: "/gafe/del_server"
        },
        formData: {
          serverName: ""
        }
      }
    }
  }
</script>
